package qkyjava;

import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.tree.ParseTree;
import org.antlr.v4.runtime.tree.ParseTreeWalker;
import qkyjava.JavaLexer;
import qkyjava.JavaParser;

public class JavaTest {
    public static void main(String[] args) {
        CharStream cs = CharStreams.fromString("package qkyjava;");
        JavaLexer lexer = new JavaLexer(cs);
        System.out.println(lexer);
        CommonTokenStream tokens = new CommonTokenStream(lexer);
        System.out.println(tokens);
        JavaParser parser = new JavaParser(tokens);
        System.out.println(parser);

        ParseTree tree = parser.packageDeclaration();
        System.out.println(parser.getTokenStream().getText());

        ParseTreeWalker walker = new ParseTreeWalker();

        TestJavaListener testJavaListener = new TestJavaListener();

        System.out.println("111111");
        System.out.println("\u000C");
        System.out.println("\u000B");
        System.out.println("222222");

        walker.walk(testJavaListener, tree);
    }
}
